<?php

function e($v){
  echo $v . '<br/>';
}


class Monster
{
      public   $package = array();
      public $hp = 100;

       public function run(){
          echo "monster run ...";
       }
       public function fire($act){
          echo "monster fire ...";
          $act->hp = $act->hp - 5;
       }
}
class Actor
{
      public   $package = array();
      public $hp = 100;
      public $zb = 4;

       public function run(){
          echo "actor run  ";
       }

       public function pickup($tools){
         $this->package[] = $tools;

         echo "actor pickup...";
       }

       public function fire($act){
          echo "actor fire ...";

          $act->hp = $act->hp - 5;

}
}

    $act = new Actor;

    $monsters = array();

    for($i=0;$i<10;$i++){
         $monsters[] = new Monster;

    }

    //向第一个怪物发动攻击

    //var_dump($monsters);

    for($i=0;$i<100;$i++){
        if ($monsters[0]->hp<=0){
           e("monster death");
           break;
        }
    e("monster hp:". $monsters[0]->hp);
    $act->fire($monsters[0]);
}

    e("act:" . $act->hp);
    e("monster:" . $monsters[0]->hp);
    e("tools:" . $tools->zb);
